

function finalize(){
	if(CHECK_LIST_NAME != ""){
		var lbName = getById("name");
		var xmlData = "<?xml version=\"1.0\"?>";
		xmlData += "<ROOT>";
		xmlData += "<FORM value=\"$execute_list_form\"> </FORM>";
		xmlData += "<ACTION value=\"FINALIZE\"></ACTION>";
		xmlData += "<CHECK_LIST_NAME value=\""+lbName.value+"\"></CHECK_LIST_NAME>";
		xmlData += "</ROOT>";
        var conn = new ClientConnector();
		conn.setCallBack(function(code){
			eval(code);
			alert("Checklist finalizado com sucesso!");
			goBack();
		});
		conn.send(xmlData);
	}else{
		alert("Não há um checklist em execução");
	}
}
	
/**
 * sincroniza os dados com o servidor
 */
function sync(){
	if(CHECK_LIST_NAME != ""){
		var lbName = getById("name");
		
		var xmlData = "<?xml version=\"1.0\"?>";
		xmlData += "<ROOT>";
		xmlData += "<FORM value=\"$execute_list_form\"> </FORM>";
		xmlData += "<ACTION value=\"SYNC\"></ACTION>";
		xmlData += "<CHECK_LIST_NAME value=\""+lbName.value+"\"></CHECK_LIST_NAME>";
		xmlData += "</ROOT>";
		
        var conn = new ClientConnector();
		conn.setCallBack(function(code){
			eval(code);
		});
		conn.send(xmlData);
	}
	
}


function getCheckList(){
	columns = new Array();
	rows = new Array();
	rowCount = 0;
	formArea = getById("$form_area");
	var xmlData = "<?xml version=\"1.0\"?>";
	xmlData += "<ROOT>";
	xmlData += "<FORM value=\"$execute_list_form\"> </FORM>";
	xmlData += "<ACTION value=\"SELECT\"></ACTION>";
	xmlData += "</ROOT>";
	
    var conn = new ClientConnector();
	conn.setCallBack(function(code){
		eval(code);
		var lbName = getById("name");
		CHECK_LIST_NAME = lbName.innerHTML;
	});
	
	conn.send(xmlData);
}
	
